<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>

<html>
    <head>
		<%@ include file="/WEB-INF/views/include/common.jsp" %>
		<meta name="AUTHOR" content="QroTech Inc." />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
		<meta http-equiv="PRAGMA" content="NO-CACHE">
		<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<title>큐로넷::위치관제시스템</title>
		
		<link rel="stylesheet" href="${cssUrl}/header-1.css" type="text/css" />
		<link rel="stylesheet" href="${cssUrl}/fancy_table.css" type="text/css" />
		<link rel="stylesheet" href="${cssUrl}/menu.css" type="text/css" />
		<link rel="stylesheet" href="${cssUrl}/table.css" type="text/css" />
		<link rel="stylesheet" href="${cssUrl}/button.css" type="text/css" />
		<link rel="stylesheet" href="${cssUrl}/m-300.css" type="text/css" />
		<link rel="stylesheet" href="${cssUrl}/m-320.css" type="text/css" />
		<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
		<script src="${jsUrl}/m-320.js"></script>
		
		
    </head>
    <body onload="init();">
    	<div id="overlay" class="overlay" >
    	</div><!-- contentWrapper end -->
    	<div class="headerContent">
	
		<div class="pageHeader">
			<%@ include file="/WEB-INF/views/include/logoLink.jsp" %>
			<div id="pageNav">
				<ul>
<!-- 					<a href="m-100.html" class="togglerHeader"><li class="hmenu0" id="hdmenu0"></li></a> -->
<!-- 					<a href="#" class="togglerHeader"><li class="hmenu1" id="hdmenu1"></li></a> -->
<!-- 					<a href="m-300.html" class="togglerHeader"><li class="hmenu2" id="hdmenu2"></li></a> -->
<!-- 					<a href="#" class="togglerHeader"><li class="hmenu3" id="hdmenu3"></li></a> -->
					<%@ include file="/WEB-INF/views/include/mainNaviStyle2.jsp" %>
				</ul>
			</div>
			<div id="pageNavRight">
				<%@ include file="/WEB-INF/views/include/titleLink.jsp" %>
			</div>
		</div>
			<div class="header_line"></div>
		</div><!--header end-->	
	
        
        	<div class="secondMenu" >
					<div id="menu">
						<ul>
							<%@ include file="/WEB-INF/views/include/innerNavi.jsp" %>
						</ul>
					</div>
						
				</div><!-- second menu end -->
			<div class="m320height">
				<div class="mainContent">
				<div class="searchInfo">
					<ul>
						<li class= "locationInfo"><span>사용자 정보 변경</span></li>
						
					</ul>
					<div class="last"><a onclick="javscript:openQuestionPopup('http://www.qronet.co.kr/help/qronet_help.html#UserModify')"><img src="${imgUrl}/question_mark.png"></a></div>
				</div><!-- searchInfo end -->
				<div class="userInfo">
				<form id="form" name="form">
					<table class="content1" cellpadding="0" cellspacing="0">
								<tr>
									<td colspan="2" height="100px"><img src="${imgUrl}/modify_user.png" style="width:500px; height:100px; border:none;"><br />&nbsp;</td>
								</tr>
								<tr>
									<th>아이디</th>
									<td><span id="loginID"></span></td>
								</tr>
								<tr>
									<th>이름</th>
									<td><input type="text" id="name" name="name"></td>
								</tr>
								<tr>
									<th>비밀번호</th>
									<td><input type="password" id="loginPW" name="loginPW"><p>* 32자 이내</p></td>
								</tr>
								<tr>
									<th>비밀번호 확인</th>
									<td><input type="password" id="loginPW1" name="loginPW1"><p>* 32자 이내</p></td>
								</tr>
								<tr>
									<th>소속</th>
									<td>
										<select name="dept" id="dept">
											<c:forEach var="dept" items="${deptInfo}">
											<option value="<c:out value="${dept.deptCode}"/>"><c:out value="${dept.deptName}"/></option>
											</c:forEach>
										</select>
									</td>
								</tr>
								<tr>
									<th>전화번호(핸드폰)</th>
									<td><input type="text" size="10" id="handPhone" name="phone"><p>* 숫자만 입력하세요.</p></td>
								</tr>
								<tr>
									<td colspan="2">&nbsp;</td>
								</tr>
					</table>
					</form>
					<div class="button"><a class="button3" onClick="updateUserInfo();">변경사항 저장</a></div>		
				</div>
			</div> <!-- mainContent end -->
		</div><!-- m320height end -->
		<div class="chart_footer">
		    <div class="footerCenter">
		       <span>Copyright ⓒ 2013 Qrotech Co.,Ltd. All rights reserved.</span>
		    </div>
	 </div>	<!-- footer end-->		
	<script language="javascript">
	function init(){
		getUserInfo();
	}
	function getUserInfo() {
		try{
    		var url="getUserInfo.json";
    		var param = "";
    		AjaxPost(url, param, function(data){
    			$('#loginID').text(data.userInfo['loginID']);
    			$('#name').val(data.userInfo['name']);
    			$('#loginPW').val(data.userInfo['loginPW']);
    			$('#loginPW1').val(data.userInfo['loginPW']);
    			$('#handPhone').val(formatter.removeChar(data.userInfo['handPhone']));
    			$('#dept option[value="'+data.userInfo['deptCode']+'"]').prop('selected', true);
    		});
    	}catch(e){
    		//logs(e);
    	}
	}
	
	function updateUserInfo() {
		var url = "updateUserInfo.json";
		var param = {};
		param['loginID'] = $('#loginID').text();
		param['name'] = $('#name').val();
		param['loginPW'] = $('#loginPW').val();
		param['handPhone'] = $('#handPhone').val();
		param['deptCode'] = $("select[name=dept]").val();
		
		if ($('#loginPW').val() != $('#loginPW1').val()) {
			alert('비밀번호를 확인하세요.');
			$('#loginPW').focus();
			return;
		} 
		AjaxPost(url, param, function(data){
			alert(data.msg);
			document.location.reload();
		});
	} 
	</script>
  </body>
</html>

